package com.example.sunjian.myapplication.event_bus;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.example.sunjian.myapplication.R;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;

/**
 * 作者：sunjian on 16/6/28 14:13
 * 邮箱：sunjian@cyhz.com
 */
public class EventBusOtherActivity extends Activity{


    private TextView mTv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.event_bus);
        EventBus.getDefault().register(this);
        mTv=(TextView)findViewById(R.id.tv);
        mTv.setBackgroundColor(Color.parseColor("#fbfbfb"));
        mTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
//                EventBus.getDefault().post("this is EventBusOtherActivity transfer");
            }
        });
    }


//    @Subscribe
//    public void onEventSunJIan(String str){
//
////        Log.e("sj","other    onEventSunJIan");
////        mTv.setText(str);
//
//    }


    @Subscribe
    public void onEventSun_JIan(String str){

//        Log.e("sj","other    onEventSunJIan");
//        mTv.setText(str);

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }
}
